Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Deleting an object
When you delete an object using the
DELETEOBJECTstatement, the destructors, if any, for every class in the hierarchy are automatically run. The destructors are run from the bottom of the class hierarchy to the top.Refer once again to this sample class hierarchy:
The
DELETEOBJECTstatement for an instance ofacme.myObjs.NECustomerinvokes theacme.myObjs.NECustomerdestructor, if it has one, followed by theacme.myObjs.CustObjdestructor, followed by theacme.myObjs.Common.CommonObjdestructor and finally the implicit destructor for the built-in root class,Progress.Lang.Object. Progress executes all the destructors automatically. You do not use theSUPERstatement in a destructor. Remember that a destructor is always public and it can have no parameters.Unlike constructors, the destructors in the class hierarchy execute to completion from bottom to top. When an object is instantiated, code in its constructors must execute from the top down to initialize super class resources that might be referenced by a subclass. By contrast, the destructors have the opportunity to free resources created by a subclass before it terminates and passes control to its super class for further clean-up, which has no knowledge of or need to reference its subclass.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |